home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / arch / arm / plat-mxc / include / mach / clock.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-09  |  2.8 KB  |  79 lines

  1. /*
  2.  * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  3.  * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
  4.  *
  5.  * This program is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU General Public License
  7.  * as published by the Free Software Foundation; either version 2
  8.  * of the License, or (at your option) any later version.
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17.  * MA  02110-1301, USA.
  18.  */
  19.  
  20. #ifndef __ASM_ARCH_MXC_CLOCK_H__
  21. #define __ASM_ARCH_MXC_CLOCK_H__
  22.  
  23. #ifndef __ASSEMBLY__
  24. #include <linux/list.h>
  25.  
  26. struct module;
  27.  
  28. struct clk {
  29.     struct list_head node;
  30.     struct module *owner;
  31.     const char *name;
  32.     int id;
  33.     /* Source clock this clk depends on */
  34.     struct clk *parent;
  35.     /* Secondary clock to enable/disable with this clock */
  36.     struct clk *secondary;
  37.     /* Current clock rate */
  38.     unsigned long rate;
  39.     /* Reference count of clock enable/disable */
  40.     __s8 usecount;
  41.     /* Register bit position for clock's enable/disable control. */
  42.     u8 enable_shift;
  43.     /* Register address for clock's enable/disable control. */
  44.     void __iomem *enable_reg;
  45.     u32 flags;
  46.     /* Function ptr to recalculate the clock's rate based on parent
  47.        clock's rate */
  48.     void (*recalc) (struct clk *);
  49.     /* Function ptr to set the clock to a new rate. The rate must match a
  50.        supported rate returned from round_rate. Leave blank if clock is not
  51.        programmable */
  52.     int (*set_rate) (struct clk *, unsigned long);
  53.     /* Function ptr to round the requested clock rate to the nearest
  54.        supported rate that is less than or equal to the requested rate. */
  55.     unsigned long (*round_rate) (struct clk *, unsigned long);
  56.     /* Function ptr to enable the clock. Leave blank if clock can not
  57.        be gated. */
  58.     int (*enable) (struct clk *);
  59.     /* Function ptr to disable the clock. Leave blank if clock can not
  60.        be gated. */
  61.     void (*disable) (struct clk *);
  62.     /* Function ptr to set the parent clock of the clock. */
  63.     int (*set_parent) (struct clk *, struct clk *);
  64. };
  65.  
  66. int clk_register(struct clk *clk);
  67. void clk_unregister(struct clk *clk);
  68. int clk_get_usecount(struct clk *clk);
  69. int clk_set_pll_dither(struct clk *clk, unsigned int pll_ppm);
  70.  
  71. /* Clock flags */
  72. #define RATE_PROPAGATES        (1 << 0)    /* Program children too */
  73. #define ALWAYS_ENABLED        (1 << 1)    /* Clock cannot be disabled */
  74. #define RATE_FIXED        (1 << 2)    /* Fixed clock rate */
  75. #define CPU_FREQ_TRIG_UPDATE    (1 << 3)    /* CPUFREQ trig update */
  76.  
  77. #endif /* __ASSEMBLY__ */
  78. #endif /* __ASM_ARCH_MXC_CLOCK_H__ */
  79.